class Solution {
public:
void rotate(vector<vector<int>>& matrix) {
int n = matrix.size();
vector<vector<int>> copy(n, vector<int>(n));
for(int i = 0; i < n; ++i) {
for(int j = 0; j < n; ++j) {
copy[i][n - 1 - j] = matrix[j][i];
}
}
matrix = copy;
}
};